<template>
    <baseSelect ref="baseSelect" @input="handleChange" :options="options"  :type="type">
      <template v-if="type == 'input'">
        <el-input
          prefix-icon="el-icon-search"
          style="width: 200px; margin: 0 10px"
          v-model="txt"
          @input="handleChange"
        ></el-input>
      </template>
      <template v-if="type == 'check'"> 2 </template>
    </baseSelect>
  </template>
  
  
  <script>
  export default {
    props:["type"],
    data() {
      return {
        txt: "",
        value: "",
        options: [
          {
            value: "001",
            label: "类型一",
          },
          {
            value: "002",
            label: "类型二",
          },
          {
            value: "003",
            label: "类型三",
          },
        ],
      };
    },
    watch:{
      value(v){
        if(v){
          this.$refs.baseSelect.value = v
        }
      }
    },
    methods: {
      handleChange(v) {
        this.value = v;
        this.$emit("input", v);
      },
      clear() {
        this.$refs.baseSelect.clear();
      },
    },
  };
  </script>